#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
//const int Max_n = 1001;
int main()
{
	int N, T;
	//int taskA[Max_n], taskB[Max_n];
	cin >> N >> T;
	vector<int> taskA(N);
	vector<int> taskB(N);
	for (int i = 0;i < N;i++)
	{
		cin >> taskA[i];
	}
	for (int i = 0;i < N;i++)
	{
		cin >> taskB[i];
	}
	/*sort(taskA, taskA + N);
	sort(taskB, taskB + N, greater<int>());*/
	sort(taskA.begin(), taskA.end());
	sort(taskB.begin(), taskB.end(), greater<int>());

	int overtime = 0;
	for (int i = 0;i < N;i++)
	{
		int total = taskA[i] + taskB[i];
		if (total > T)
		{
			overtime += total - T;
		}
	}
	cout << overtime;
	return 0;
}